 
<?php
include "../proses/konek.php";
session_start();
if(!isset($_SESSION['username']))
 {   
   ?><script language="javascript">alert('anda blm login');
document.location='../'</script><?php
 }
else
{
$username = $_SESSION['username'];
$status = $_SESSION['status'];
} 
$simpan2=mysql_query("SELECT * FROM  $status where email = '$username'");
$hasil2=mysql_fetch_array($simpan2);

?>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" href="../css/bootstrap/css/bootstrap.css" >
    <link rel="stylesheet"href="../css/bootstrap/css/profile.css" >
	<link rel="stylesheet"href="../css/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="../css/sidebar.css">
	<link rel="stylesheet" type="text/css" href="../css/bootstrap/css/bootstrap-theme.min.css">
	<link href="../css/dataTables.bootstrap.css" rel="stylesheet">

	<title></title>
	<?php	
	require_once('../render.php');
	$render=new render;
	$render->navigasi();
	$render->icon();
	$render->profile($status, $username);
	
?>
</head>
<body style="overflow-x:hidden; " class="background">

<div id="wrapper">
	<div id="sidebar-wrapper">
		<?php
		include ('menuslide.php');
		$menu=new menu;
		$menu->init($username, $status);
		?>
	</div>
	<div id="page-content-wrapper">
		<div class="container-fluid">
			<div class="row" style="margin-top:80px">
				<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="subcontent">
					<div class="panel panel-default">
					<strong><h1>POSTING LIST</h1></strong>
	                        <div class="panel-heading">
	                            TABLE POSTING
	                        </div>
	                        <!-- /.panel-heading -->
	                        <div class="panel-body">
	                            <div class="table-responsive">
	                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
	                                    <?php $sql=mysql_query("select * from posting where author='$username' ") ?>
	                                    <thead>
	                                        <tr>
	                                            <th>#</th>
	                                            <th>Judul</th>
	                                            <th>Tgl dibuat/diubah</th>
	                                            <th>Edit</th>
	                                            
	                                        </tr>
	                                    </thead>
	                                    <tbody>
	                                    <?php 
	                                    $j=1;
	                                    while ($cetak = mysql_fetch_assoc($sql))

	                                     {
	                                    	echo "<tr class='odd gradeX'>
	                                            <td>".$j."</td>
	                                            <td>".$cetak['judul']."</td>
	                                            <td>".$cetak['time']."</td>
	                                            <td>
	                                            <a href='edit.php?id=".$cetak['idpost']."'>
												<button class='btn btn-primary' type='submit' name='save' id='save'>EDIT</button> <strong>/</strong>
												<a>
	                                            <form action='javascript:myFunction(".$cetak['idpost'].") '>
												<button class='btn btn-danger' type='submit' >DELETE</button>
												</form></td>
	                                            
	                                        </tr>";
	                                        $j=$j+1;
	                                    } ?>
	                                        
	                                       
	                                    </tbody>
	                                </table>
	                            </div>
	                            <!-- /.table-responsive -->
	                        </div>
	                        <!-- /.panel-body -->
	                    </div>
					</div>
				
				</div>
			</div>
		</div>
	</div>				
			</div>
		</div>
	</div>
</div>
<div>
<?php
$render->footer();
?>
</div>
<!-- JQuery Core -->
<script src="../js/search.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<!-- Custom Sidebar Javascript -->

<!-- Custom Javascript Load Page -->

<script type="text/javascript" src="../css/bootstrap/js/bootstrap.js"></script>

<script type="text/javascript" src="../js/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../js/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="../js/metisMenu.min.js"></script>
<script src="../js/sb-admin-2.js"></script>
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
        $('#dataTables-example').dataTable();
    });
    </script>
<script type="text/javascript">
	$('#list').change(function() {
	var selected = $('#list option:selected');
	var alamat='listpost.php?list='+selected.val();
	document.location=alamat;
	}
</script>
<script >

function myFunction(abc) {
  var elemen='../proses/delete.php?id='+abc;
    var r = confirm("ANDA YAKIN INGIN MENGHAPUS POSTING!");
    if (r == true) {
        document.location=elemen;
    } else {
       document.location='listpost.php';
    }
}
</script>
<script type="text/javascript" src="../js/sidebar.js"></script>
</body>
</html>

	
